package com.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dao.LunboimgsDao;
import com.dao.ZixunDao;
import com.pojo.Lunboimgs;
import com.pojo.Question;
import com.pojo.Zixun;
import com.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LunboService extends ServiceImpl<LunboimgsDao, Lunboimgs> {

    @Autowired
    private LunboimgsDao lunboimgsDao;
    public IPage getPage(int page, int limit, String type) {
        Page p=new Page(page,limit);
        QueryWrapper<Lunboimgs> qw=new QueryWrapper<>();
        if (StringUtil.isNotNull(type)){
            qw.like("topicid",type);
        }
        IPage iPage=lunboimgsDao.selectPage(p,qw);
        return iPage;
    }

    public List gettu(String type) {
        QueryWrapper<Lunboimgs> qw=new QueryWrapper<>();
        qw.eq("topicid",type);
        qw.eq("imgstatus",1);
        return  lunboimgsDao.selectList(qw);
    }
}
